$(document).ready(function () {
    initMonthReport(); // 初始化月报报表
})


function initMonthReport() {

    /*
     * 1. init
     * 2. option
     * 3. setOption
     * 4. 数据加载
    * */

    var source = Mock.mock({
        'list|4':[{
            'name':function () {
                return '广告'+Mock.Random.increment()
            },
            value:'@natural(200,500)'
        }]
    });  //  Mock.mock(rules)


    var chart = echarts.init(document.getElementById('monthReport'));
    var option = {
        tooltip: {
            trigger: 'item'
        },
        legend: {
            top: '5%',
            left: 'center',
        },
        series: [
            {
                name: '访问来源',
                type: 'pie',
                radius: '50%',
                data: source.list,
                emphasis: {
                    itemStyle: {
                        shadowBlur: 10,
                        shadowOffsetX: 0,
                        shadowColor: 'rgba(0, 0, 0, 0.5)'
                    }
                }
            }
        ]
    };

    chart.setOption(option);


}